var stdin = process.stdin;
/*
*stdin继承了EventEmitter
*继承了strem.Readable
*/ 
stdin.on("data", function(chunk){
    var chunk = chunk.toString("utf-8");
    var result = chunk.slice(0,-2);
    if(result == ""){
        stdin.emit("end")
    }
})

stdin.on("end",function(){
    console.log("stdin ended");
})